package com.chuang.bootplus.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.chuang.bootplus.base.enumerate.HttpStatusEnum;
import com.chuang.bootplus.base.exception.BusException;
import com.chuang.bootplus.base.utils.ApiResponse;
import com.chuang.bootplus.base.utils.BeanUtil;
import com.chuang.bootplus.entity.RelUserMedal;
import com.chuang.bootplus.mapper.RelUserMedalMapper;
import com.chuang.bootplus.po.medal.MedalListPO;
import com.chuang.bootplus.po.medal.MedalSavePO;
import com.chuang.bootplus.service.RelUserMedalService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chuang.bootplus.vo.MedalListVO;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ${author}
 * @since 2021-08-17
 */
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class RelUserMedalServiceImpl extends ServiceImpl<RelUserMedalMapper, RelUserMedal> implements RelUserMedalService {

    private final RelUserMedalMapper relUserMedalMapper;

    @Override
    public ApiResponse<MedalListVO> medalList(MedalListPO po) {
//        List<RelUserMedal> list = list(new LambdaQueryWrapper<RelUserMedal>()
//                .eq(RelUserMedal::getUserId, po.getUserId()));
//        List<MedalListVO> medalListVOS = BeanUtil.listA2ListB(list, MedalListVO.class);

        List<MedalListVO> medalListVOS = relUserMedalMapper.medalList(po);
        return new ApiResponse<>(medalListVOS);
    }
}
